//
//  Pack.h
//  Urban Words
//
//  Created by Tim Brandin on 2011-12-09.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface UWRequest : NSObject <NSURLConnectionDataDelegate, NSURLConnectionDataDelegate> {
    SEL action;
    id target;
    NSMutableData *receivedData;
}

@property (retain, nonatomic) NSMutableURLRequest *request;
@property (retain, nonatomic) id <NSURLConnectionDelegate, NSURLConnectionDataDelegate> delegate;
@property (retain, nonatomic) NSURLConnection *connection;

typedef enum CRUD {
    CREATE,
    READ,
    UPDATE,
    DELETE
} CRUD;

- (void)start;
- (void)addListener:(id)object action:(SEL)selector;

- (UWRequest *)initWithMethod:(NSString *)method atServer:(NSString *)server operation:(CRUD)operation;
- (BOOL)setPayload:(NSDictionary *)payload;
+ (NSString *)crudToString:(CRUD)operation;

@end
